import java.awt.Point;
import java.util.Random;

/**
 * 
 * @author Shawn Gibbs
 * @version v0.1
 *
 */
public class Computer extends Player{
	/**
	 * This will set up name to be Computer
	 */
	public Computer(String borderID){
		super(borderID);
		shipsLeft = 5;
		
	}
	/**
	 * This simply sets up ships at the point 
	 * location. Both the Front and the Direction are randomly picked
	 * @param Point[] This is a 2 Part array of Direction and Front.
	 */
	public Point[]  setupNextShip(){
		Point[] points = new Point[2];
		points[0] = new Point(r.nextInt(10), r.nextInt(10));
		do{
			points[1] = new Point(r.nextInt(10), r.nextInt(10));
		} while( points[0].getX() != points[1].getX() && points[0].getY() != points[1].getY() || points[0].equals(points[1]) );
		shipsLeft--;
		return points;
		
	}
	
	/**
	 * This randomly picks a location for the computer to fire at. 
	 * @return returns the point to fire at.
	 */
	public Point startTurn(){
		Random r = new Random();
		
		return new Point(r.nextInt(10), r.nextInt(10));
	}
	
	/*
	 * If we failed to place a ship we need to tell the computer 
	 * that we failed. changing the shipsLeft allow us to do this. 
	 */
	public void incShipsLeft(){
		shipsLeft++;
	}
	private int shipsLeft;
	protected String borderID;
	protected String name;
	
	private Random r = new Random();

	public static void main(String[] args){
		Computer c = new Computer("2");
		Point[] p = c.setupNextShip();
		System.out.println("First:" + p[0] + " Second:" + p[1]);
	}
}
